<script lang="ts" setup>
import { ref,watch,computed, onMounted } from 'vue'
import { useAddUserStore } from '../../../store/addUser';
import { useRoleSelectStore } from '../../../store/roleSelect';
import role from '../../../api/role';
const addUserStore = useAddUserStore();
const roleSelectStore = useRoleSelectStore();
onMounted(async()=>{
    await role.getRoleSelect().then(res=>{
        roleSelectStore.roleSelect = res.data.data;
    }).catch(err=>{
        console.log(err)
    })
})
</script>
<template>
    <el-select v-if="roleSelectStore.roleSelect.length > 0"   v-model="addUserStore.user.roleId" clearable placeholder="请勾选角色" multiple style="width: 240px">
        <el-option v-for="item in roleSelectStore.roleSelect" :key="item.value" :label="item.label" :value="item.value" />
    </el-select>
</template>